<form action="" method="post">
    <input type="text" name="txt">
    <input type="submit" name="addarray" value="创建数组">
    <input type="submit" name="outputarray" value="输出数组">
</form>
<?php
session_start();
/**
 * User: lie
 * Date: 2020/12/8 14:02
 * Title: 创建并输出数组
 * Description:
 * Error:
 */
if ($_POST['addarray']) {
    if ($_POST['txt'] == "") {
        echo "创建空数组";
    } else {
        $_SESSION['array124-140'] = $_POST['txt'];
        echo "创建数组成功";
    }
}
if ($_POST['outputarray']) {
    if (isset($_SESSION['array124-140'])) {
        $array = explode("#", $_SESSION['array124-140']);
        print_r($array);
        session_destroy();
    } else {
        echo "不支持空数组输出，请先创建数组";
    }
}
